package com.itheima.mapper;

import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

public interface OrderInfoMapper {
    //int addOrder(Order order);

    long findOrderByDateAndMemberIdAndSetMealId(@Param("orderDate") Date orderDate, @Param("setmealId") Integer setmealId, @Param("memberId") Integer memberId);

    @Update("update t_order set payStatus=1 where orderId=#{orderId}")
    void updateStatus(@Param("orderId") String orderId);

    @Select("select payStatus from t_order where id=#{id}")
    int findPayStatus(@Param("id") int id);

    @Update("update t_order set orderid=#{orderId} where id=#{id}")
    void addOrderId(@Param("orderId") String orderId, @Param("id") String id);

    @Delete("delete * from t_order where id=#{id}")
    void cancelOrder(@Param("id") int id);
}
